package com.ruoyi.web.controller.common;

import com.ruoyi.common.utils.file.FileUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("/tool/file")
public class FileController {

    @Value("${ruoyi.profile:E:\\data\\ruoyi}")
    String filePath;


    @ApiOperation(value = "下载文件")
    @RequestMapping(value = "/download/manual", method = RequestMethod.GET)
    public void downloadFile1(HttpServletResponse response, String fileName) {
        System.out.println(fileName);
//        InputStream resourceAsStream= this.getClass().getResourceAsStream("/template/" + fileName);
        FileUtils.downFile(response,filePath + "/manual/",fileName);

    }
}
